var APP_ICON_SCALE_IN_TIME = 500;
var APP_ICON_SCALE_IN_DELAY = 700;
+const OVERSHOOT_THRESHOLD = 20;
+
const SWITCHEROO_BUS_NAME = 'net.hadess.SwitcherooControl';
const SWITCHEROO_OBJECT_PATH = '/net/hadess/SwitcherooControl';
this._availWidth = 0;
this._availHeight = 0;
+ this._lastOvershootY = -1;
+
Main.overview.connect('hidden', () => this.goToPage(0));
this._grid.connect('space-opened', () => {
let fadeEffect = this._scrollView.get_effect('fade');
let [, gridHeight] = this.get_transformed_size();
let gridBottom = gridY + gridHeight;
- // Within the grid boundaries, or already animating
- if (dragEvent.y > gridY && dragEvent.y < gridBottom ||
- this._adjustment.get_transition('value') != null)
+ // Already animating
+ if (this._adjustment.get_transition('value') !== null)
+ return;
+
+ // Within the grid boundaries
+ if (dragEvent.y > gridY && dragEvent.y < gridBottom) {
+ // Check whether we moved out the area of the last switch
+ if (Math.abs(this._lastOvershootY - dragEvent.y) > OVERSHOOT_THRESHOLD)
+ this._lastOvershootY = -1;
return;
+ }
+
+ // Still in the area of the previous page switch
+ if (this._lastOvershootY >= 0)
+ return;
+
+ this._lastOvershootY = dragEvent.y;
// Moving above the grid
let currentY = this._adjustment.value;
}
this._eventBlocker.visible = this._currentPopup !== null;
+ this._lastOvershootY = -1;
}
_canAccept(source) {